var is_send =0;

//获取选择的经销商
function getChooseMep() {
    var mepNo = $("input[name='add']:checked").val();

    if(checkIsNull(mepNo)){
        alertTips("请选择经销商！");
        return null;
    }else{
        return mepNo;
    }
}

//下单
function createOrder() {
    if(is_send<1){
        var mepNo = getChooseMep();
        if(checkIsNotNull(mepNo)&&checkIsNotNull(orderJson)){
            is_send = 1;
            $.ajax({
                type: "post",
                url: '/shop/createOrder.do',
                dataType: "json",
                data: {
                    'order_json':orderJson,
                    'mep_no':mepNo
                },
                success: function(resp){
                    console.log(resp);
                    if(resp.result==="success"){
                        location.href=ctx+"/shop/toOrderSuccess.do";
                    }else{
                        alertTips("下单异常，请重试！");
                    }
                }
            });
        }
    }else{
        alertTips("请不要重复下单！");
    }
}

//跳转到修改地址页面
function toEditAddress() {
    location.href=ctx+'/shop/toEditAddress.do';
}
